import { app } from 'vue';
import DOMPurify from 'dompurify';
//安全渲染指令
export default function installSafeHtmlDirective(app) {
  app.directive('safe-html', {
    mounted(el, binding) {
      el.innerHTML = DOMPurify.sanitize(binding.value);
    },
    updated(el, binding) {
      el.innerHTML = DOMPurify.sanitize(binding.value);
    }
  });
}